package h0730;

import java.util.*;

/**
  * @description 掌握的单词个数
  * @author 不知名帅哥
  * @date 2024/7/31 0:05
  * @version 1.0
*/
public class NumberOfGraspWords {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n = sc.nextInt(); //单词个数
        sc.nextLine();
        String[] words=new String[n];
        for (int i = 0; i < n; i++) {
            words[i]=sc.nextLine();
        }
        String s=sc.nextLine();
        int ans=getRes(words,s);
        System.out.println(ans);
    }

    private static int getRes(String[] words, String s) {
        //统计？的个数
        int m=0;
        char[] chars = s.toCharArray();
        HashMap<Character, Integer> map = new HashMap<>();
        for (char c : chars) {
            if (c=='?'){
                m++;
            }
            map.put(c,map.getOrDefault(c,0)+1);
        }
        int ans= words.length;
        for (String word : words) {
            int count=0;
            int tempM=m;
            for (int i = 0; i < word.length(); i++) {
                char c = word.charAt(i);
                if (map.containsKey(c)){
                    map.put(c, map.get(c)-1);
                }else {
                    if (count<tempM){
                        tempM--;
                        count++;
                    }else {
                        ans--; //不满足要求
                        break;
                    }
                }
            }
        }
        return ans;
    }
}
